<template>
  <div class="app-container">
    <div class="head">
      <img src="@/assets/img/Layout/position.png" />
      <p class="see-block">供应商数据下发</p>
    </div>
    <div class="view-container">
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            class="btn-success"
            type="primary"
            icon="el-icon-plus"
            size="mini"
            @click="add()"
            v-hasPermi="['system:sysDataDelivery:issuedBySuppliers']"
          >新建供应商数据下发</el-button>
        </el-col>
      </el-row>
      <el-table v-loading="loading" :data="dataList" @row-click="handleView" border>
        <el-table-column label="序号" type="index" align="center" width="50">
          <template slot-scope="scope">
            <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column label="下发类型" align="center" prop="dataType">
          <template slot-scope="scope">
            <div v-if="scope.row.dataType == '2'">供应商下发</div>
          </template>
        </el-table-column>
        <el-table-column label="编码" align="center" prop="coding" />
        <el-table-column label="公司组织" align="center" prop="orgNames"  :show-overflow-tooltip="true" width="300" />
        <el-table-column label="供应商" align="center" prop="size" />
        <el-table-column label="是否成功" align="center" prop="isSuccess">
          <template slot-scope="scope">
            <div v-if="scope.row.isSuccess == '0'" style="color:#fd562c">否</div>
            <div v-if="scope.row.isSuccess == '1'" style="color:#52C41A">是</div>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </div>
  </div>
</template>
<script>
import { listSupplierDataReleased } from "@/api/system/basedata/dataReleased/dataReleased"
export default {
  name: "list",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 下发列表数据
      dataList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        dataType: 2
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    // 获取列表
    getList() {
      this.loading = true
      listSupplierDataReleased(this.addDateRange(this.queryParams)).then(res => {
        this.dataList = res.rows
        this.total = res.total
        this.loading = false
      })
    },
    // 新建
    add(){
      this.$router.push({path:"/basedata/supplier/dataReleased/add"})
    },
    // 查看
    handleView(row){
      this.$router.push({path:"/basedata/supplier/dataReleased/detail", query:{id: row.id}})
    }
  }
}
</script>